package com.training.player;// com.training.player.MediaControlReceiver.java
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class PlayerReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        
        // 发送广播给 PlayerService 处理
        Intent serviceIntent = new Intent(context, PlayerService.class);
        serviceIntent.setAction(action);
        
        if (PlayerService.ACTION_PLAY.equals(action)) {
            context.startService(serviceIntent);
        } else if (PlayerService.ACTION_PAUSE.equals(action)) {
            context.startService(serviceIntent);
        } else if (PlayerService.ACTION_STOP.equals(action)) {
            context.startService(serviceIntent);
        }
    }
}
